/*
 * CFood.cpp
 *
 *  Created on: 31.10.2012
 *      Author: christina
 */

#include "CFood.h"
#include <iostream>
#include "CEnvironment.h"
#include <time.h>
#include <stdlib.h>

using namespace std;

int CFood::act() {
	print();
	return 0;
}

void CFood::print() {
	cout << "F";
}

int CFood::giveMeFood(int cntFood){
	food = food - cntFood;
	return cntFood;
}

CFood::CFood(int defFood) {

	/*
	 * Define the food count inside the Anthill
	 * If the constructor is not initialized on creation
	 * the default value of the constructor in CAnthill.h is 200
	 */
	food = defFood;

	/*
	 * Get the environment singelton so I could calculate the M N random
	 */

	CEnvironment* environment = CEnvironment::getInstance(10,10);

	this->M = rand() % environment->getM();
	this->N = rand() % environment->getN();

	/*
	 * If we know where we are, place the Anthill himself into playground
	 * and store the N M values inside the the Anthill
	 */

	environment->getPlayground()->getArea(M,N)->setType(this);

}

CFood::~CFood() {
	// TODO Auto-generated destructor stub
}
